<div ng-cloak>

  <div uib-navbar profile="profile"></div>

  <div class="framework-main">
    <div uib-sidebar profile="profile" class="sidebar-full" is-collapse="profileview.isCollapse" groups="profileview.sidebarGroups" item-selected="profileview.sidebarSelected"></div>

    <div class="framework-body">
      <uib-breadcrumb class="breadcrumb-wrapper" breads="profileview.breads"></uib-breadcrumb>

      <div ng-if="type === 'view' && !loading">
<!--        <div class="tools">
          <div ng-if="cfg.hasAuth(profile, cfg.api.profile.update.url)" class="btn-group" role="group" aria-label="">
            <a ng-click="goview('profileview', 'edit')" class="btn btn-default btn-warning" uib-tooltip="编辑" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-edit"></i><span class="hidden-xs"> 编辑</span></a>
          </div>
          <div ng-if="cfg.hasAuth(profile, cfg.api.profit.reset.url)" class="btn-group" role="group" aria-label="">
            <a ng-click="goview('profileview', 'reset')" class="btn btn-default btn-danger" uib-tooltip="重置密码" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-edit"></i><span class="hidden-xs"> 重置密码</span></a>
          </div>
        </div>-->

        <div class="row <!--mt-10-->">
          <div class="col-md-12">
            <div class="panel panel-default panel-csc">
              <div class="panel-heading">
                <div class="panel-title">个人信息</div>
              </div>
              <div class="panel-body">
                <div class="form form-horizontal">
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>用户姓名:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.name}}</p>
                    </div>
                  </div>
                  <div class="form-group form-select-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>钉钉账号:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.ding_id}}</p>
                    </div>
                  </div>
                  <div class="form-group form-select-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>手机号:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.cellphone}}</p>
                    </div>
                  </div>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>用户角色:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{getRoleToArray(info.role, 'name').join(",")}}</p>
                    </div>
                  </div>
                  <div class="form-group" ng-if="hasRoleId(info.roles,'4') && info.bossWangbas">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>网吧名称:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.bossWangbas ? info.bossWangbas.name: ''}}</p>
                    </div>
                  </div>
                  <div class="form-group" ng-if="hasRoleId(info.roles,'9')">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>渠道邀请码:</label>
                    <div class="col-sm-10">
                      <p class="form-control-static">{{info.code ? info.code: ''}}</p>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div ng-if="type === 'edit' && !loading">
        <div class="tools">
          <div class="btn-group" role="group" aria-label="">
            <a href="{{redirect_url}}" class="btn btn-default btn-info" uib-tooltip="返回" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-chevron-left"></i><span class="hidden-xs"> 返回</span></a>
          </div>
        </div>

        <div class="row mt-10">
          <div class="col-md-12">
            <div class="panel panel-default panel-csc">
              <div class="panel-heading">
                <div class="panel-title">编辑用户</div>
              </div>
              <div class="panel-body">
                <form name="form" class="form form-horizontal" ng-submit="editSubmit(id, form.$valid)" novalidate>
                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>用户姓名:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.name" name="name" class="form-control" placeholder="用户姓名" required>
                      <div class="error-messages" ng-messages="form.name.$error">
                        <small class="error" ng-message="required">用户姓名（*必填）</small>
                      </div>
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>钉钉账号:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.ding_id" class="form-control" placeholder="钉钉账号">
                    </div>
                  </div>

                  <div class="form-group form-select-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>手机号:</label>
                    <div class="col-sm-10">
                      <input type="text" ng-model="info.cellphone" name="cellphone" class="form-control" placeholder="手机号" required maxlength="11" minlength="11" ng-pattern="/^1\d{10}$/">
                      <div class="error-messages" ng-messages="form.cellphone.$error">
                        <small class="error" ng-message="required">手机号（*必填）</small>
                        <small class="error" ng-message="minlength">请输入11位手机号</small>
                        <small class="error" ng-message="maxlength">请输入11位手机号</small>
                        <small class="error" ng-message="pattern">请输入正确格式的手机号</small>
                      </div>
                    </div>
                  </div>

                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="btn-group" role="group" aria-label="">
                        <button class="btn btn-default btn-success" ng-disabled="form.$invalid"><i class="fa fa-fw fa-save"></i> 保存</button>
                      </div>
                      <div class="btn-group" role="group" aria-label="">
                        <a href="{{redirect_url}}" class="btn btn-default btn-danger"><i class="fa fa-fw fa-mail-forward"></i> 放弃</a>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div ng-if="type === 'reset' && !loading">
        <div class="tools">
          <div class="btn-group" role="group" aria-label="">
            <a href="{{redirect_url}}" class="btn btn-default btn-info" uib-tooltip="返回" tooltip-append-to-body="true" tooltip-placement="top" ><i class="fa fa-fw fa-chevron-left"></i><span class="hidden-xs"> 返回</span></a>
          </div>
        </div>

        <div class="row mt-10">
          <div class="col-md-12">
            <div class="panel panel-default panel-csc">
              <div class="panel-heading">
                <div class="panel-title">重置密码</div>
              </div>
              <div class="panel-body">
                <form name="form" class="form form-horizontal" ng-submit="resetPasswordSubmit(id, form.$valid)" novalidate>

                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>旧密码:</label>
                    <div class="col-sm-10">
                      <input type="password" ng-model="info.confirm" name="confirm" class="form-control" placeholder="确认登录密码" required equal-to="info.password">
                      <div class="error-messages" ng-messages="form.confirm.$error">
                        <small class="error" ng-message="required">请确认登录密码（*必填）</small>
                        <small class="error" ng-message="notEqual">两次输入的登录密码不一致</small>
                      </div>
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>新登录密码:</label>
                    <div class="col-sm-10">
                      <input type="password" ng-model="info.password" name="password" class="form-control" placeholder="登录密码" minlength="6" maxlength="10" ng-minlength="6" ng-maxlength="10" required ng-pattern="/(?=.*[a-zA-Z])(?=.*[^a-zA-Z])/">
                      <div class="error-messages" ng-messages="form.password.$error">
                        <small class="error" ng-message="required">登录密码必须为6-10个字符（*数字或英文字符）</small>
                        <small class="error" ng-message="minlength">登录密码必须为6-10个字符（*数字或英文字符）</small>
                        <small class="error" ng-message="maxlength">登录密码必须为6-10个字符（*数字或英文字符）</small>
                        <small class="error" ng-message="pattern">登录密码必须包含数字和英文字符</small>
                      </div>
                    </div>
                  </div>

                  <div class="form-group">
                    <label class="col-sm-2 control-label"><span class="span-danger">*</span>确认新登录密码:</label>
                    <div class="col-sm-10">
                      <input type="password" ng-model="info.confirm" name="confirm" class="form-control" placeholder="确认登录密码" required equal-to="info.password">
                      <div class="error-messages" ng-messages="form.confirm.$error">
                        <small class="error" ng-message="required">请确认登录密码（*必填）</small>
                        <small class="error" ng-message="notEqual">两次输入的登录密码不一致</small>
                      </div>
                    </div>
                  </div>

                  <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                      <div class="btn-group" role="group" aria-label="">
                        <button class="btn btn-default btn-success" ng-disabled="form.$invalid"><i class="fa fa-fw fa-save"></i> 确定重置</button>
                      </div>
                      <div class="btn-group" role="group" aria-label="">
                        <a href="{{redirect_url}}" class="btn btn-default btn-danger"><i class="fa fa-fw fa-mail-forward"></i> 放弃重置</a>
                      </div>
                    </div>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>

</div>
